
package com.be.beadmin.product.repository;

import com.be.beadmin.product.entity.UserWorkHourInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
* @author zjm
* @date 2023-11-22
**/
public interface UserWorkHourInfoRepository extends JpaRepository<UserWorkHourInfo, String>, JpaSpecificationExecutor<UserWorkHourInfo> {

    UserWorkHourInfo findUserWorkHourInfoByIdAndDelete(String id, Integer delete);


    List<UserWorkHourInfo> findUserWorkHourInfoByProcessIdAndDelete(String id, Integer delete);
    UserWorkHourInfo findUserWorkHourInfoById(String id);


    UserWorkHourInfo findUserWorkHourInfoByUserIdAndProcessIdAndDelete(String userId,String processId, int delete);

    int countUserWorkHourInfoByProcessIdAndProcessStatusNotAndDelete(String processId, int state, int delete);

    int countUserWorkHourInfoByProcessIdAndProcessStatusNotAndUserIdNotAndDelete(String processId, int state, String userId ,  int delete);
    int countUserWorkHourInfoByProcessIdAndProcessStatusAndDelete(String processId, int state, int delete);
    @Query(value = "select uwhi.processStatus  from UserWorkHourInfo uwhi where uwhi.processId = ?1 and uwhi.userId = ?2 and uwhi.delete = ?3")
    Integer findStateByProcessIdAndUserIdAndDelete(String processId, String userId, int delete);


}